﻿namespace MvvmTools.Tests
{
    using NUnit.Framework;
    using Shouldly;

    [TestFixture]
    public class PropertyChangeFixture
    {
        [Test]
        public void PropertyChangeShouldImplementEquLogicWhenEqu()
        {
            // Given
            var change1 = new PropertyChange(10, "a");
            var change2 = new PropertyChange(10, "a");

            // When

            // Then
            change1.Equals(change2).ShouldBe(true);
            (change1 == change2).ShouldBe(true);
            (change1 != change2).ShouldBe(false);
        }

        [Test]
        public void PropertyChangeShouldImplementEquLogicWhenNotEquById()
        {
            // Given
            var change1 = new PropertyChange(10, "a");
            var change2 = new PropertyChange(11, "a");

            // When

            // Then
            change1.Equals(change2).ShouldBe(false);
            (change1 == change2).ShouldBe(false);
            (change1 != change2).ShouldBe(true);
        }

        [Test]
        public void PropertyChangeShouldImplementEquLogicWhenNotEquByPropertyName()
        {
            // Given
            var change1 = new PropertyChange(11, "a");
            var change2 = new PropertyChange(11, "b");

            // When

            // Then
            change1.Equals(change2).ShouldBe(false);
            (change1 == change2).ShouldBe(false);
            (change1 != change2).ShouldBe(true);
        }

        [Test]
        public void PropertyChangeShouldImplementEquLogicWhenNotEquByIdAndPropertyName()
        {
            // Given
            var change1 = new PropertyChange(9, "a");
            var change2 = new PropertyChange(11, "b");

            // When

            // Then
            change1.Equals(change2).ShouldBe(false);
            (change1 == change2).ShouldBe(false);
            (change1 != change2).ShouldBe(true);
        }
    }
}
